apiVersion: v1
kind: Service
metadata:
    name: portal-db-svc
    namespace: spark-cluster
spec:
    ports:
        - port: 5432
          targetPort: 5432
          name: postgres-db
        - port: 22
          targetPort: 22
          name: postgres-ssh
    selector:
      	name: portal-db 


---
apiVersion: v1
kind: ReplicationController
metadata:
    name: portal-db-rc
    namespace: spark-cluster
spec:
    replicas: 1
    template:
        metadata:
            labels:
                name: portal-db
        spec:
            containers:
            - image: index.tenxcloud.com/zhangshun/postgres:9.6
              name: postgresql
              env:
                - name: POSTGRES_DB
                  value: cds
                - name: POSTGRES_USER
                  value: cdsadmin
                - name: POSTGRES_PASSWORD
                  value: pgpassw0rd
              volumeMounts:
              - mountPath: /var/lib/postgresql/data
                name: portaldb
              ports:
              - containerPort: 5432
                name: postgres-db
              - containerPort: 22
                name: portsgres-ssh

            volumes:
            - name: portaldb
              glusterfs:
                  endpoints: glusterfs-cluster
                  path: {{ gluster_hds_portaldb_volname }}
                  readOnly: false
